var Order = require("../models/orders.js");

totleTable = function (sdate,edate) {
    return new Promise ((resolve, reject) => {
        // order.create( opts ,function(err,doc){
        //
        // })
        Order.find({"ifPay":true,"ifCancel":false,"$and":[{"date":{"$gte":sdate + " 0:0:0"}},{"date":{"$lte":edate + " 23:59:59"}}]},function (err2,result2) {
            if (err2) reject(err2)
            else  console.log(result2)
             resolve(result2)
        })
    })
}

module.exports = totleTable